﻿using System.Collections.Generic;
using System.ComponentModel;
using System.Web.Mvc;
using System.Web.Routing;
using ShopB2C.Entity;
using ShopB2C.Helper;
using ShopB2C.Interfaces;
using ShopB2C.ViewModels;

namespace ShopB2C.Controllers.Brower {
    public class HelpController : BaseController {
        private static IHelp _help;

        protected override void Initialize(RequestContext requestContext) {
            base.Initialize(requestContext);
            this.SiteMapPathAdd("首页", Url.Action("Index", "Home"));
        }

        public HelpController() {
            _help = DataBaseExecuter.CreateClassByName<IHelp>("Help");
        }              

        /// <summary>
        /// 首页
        /// </summary>
        public ActionResult Index() {
            return View();
        }
        /// <summary>
        /// 帮助中心
        /// </summary>
        public ActionResult View([DefaultValue(0)]int id) {
            HelpSectionEntity hse = _help.GetHelpSectionById(id);

            this.SiteMapPathAdd("帮助中心", Url.Action("Index", "Help"));
            this.SiteMapPathAdd(hse.Title);

            return View(new HelpSectionViewModel() {
                HelpSection = hse,
                HelpSectionList = ViewData["HelpSection"] as List<HelpSectionEntity>,
                HelpTypeList = ViewData["HelpType"] as List<HelpTypeEntity>
            });
        }

    }
}